/**
 * Project Name:spring-cloud-pilot File Name:ClassPathChangedEvent.java Package Name:org.spring.cloud.pilot.event
 * Date:2019年10月21日上午9:42:47 Copyright (c) 2019, dengqian37@126.com All Rights Reserved.
 *
 */

package org.spring.cloud.pilot.event;

import java.util.Set;

import org.spring.cloud.pilot.filewatch.ChangedFiles;
import org.springframework.context.ApplicationEvent;
import org.springframework.util.Assert;

/**
 * ClassName:ClassPathChangedEvent <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 * Date: 2019年10月21日 上午9:42:47 <br/>
 * 
 * @author dengqian
 * @version
 * @since JDK 1.8
 * @see
 */
public class ClassPathChangedEvent extends ApplicationEvent {

    /**
    		* serialVersionUID:TODO(用一句话描述这个变量表示什么).
    		* @since JDK 1.6
    		*/
    	
    private static final long serialVersionUID = 6581072022707636394L;

    private final Set<ChangedFiles> changeSet;

    private final boolean restartRequired;

    /**
     * Create a new {@link ClassPathChangedEvent}.
     * 
     * @param source the source of the event
     * @param changeSet the changed files
     * @param restartRequired if a restart is required due to the change
     */
    public ClassPathChangedEvent(Object source, Set<ChangedFiles> changeSet, boolean restartRequired) {
        super(source);
        Assert.notNull(changeSet, "ChangeSet must not be null");
        this.changeSet = changeSet;
        this.restartRequired = restartRequired;
    }

    /**
     * Return details of the files that changed.
     * 
     * @return the changed files
     */
    public Set<ChangedFiles> getChangeSet() {
        return this.changeSet;
    }

    /**
     * Return if an application restart is required due to the change.
     * 
     * @return if an application restart is required
     */
    public boolean isRestartRequired() {
        return this.restartRequired;
    }

}
